//
//  WeatherCollectionViewCell.m
//  EDPS
//
//  Created by dllo on 15/12/7.
//  Copyright © 2015年 张维扬. All rights reserved.
//

#import "WeatherCollectionViewCell.h"
#define HOLS [[UIScreen mainScreen] bounds]

@interface WeatherCollectionViewCell ()
@property (nonatomic,retain) UILabel *calLabel;
@property (nonatomic,retain) UILabel *timeLabel;
@property (nonatomic,retain) UILabel *weatherLabel;
@property (nonatomic,retain) UILabel *tempLabel;
@end

@implementation WeatherCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self views];
    }
    return self;
}
- (void)views
{
    self.calLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, HOLS.size.width / 3, 30)];
    [self.contentView addSubview:self.calLabel];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, HOLS.size.width / 3 , 30)];
    [self.contentView addSubview:self.timeLabel];
    
    self.weatherLabel = [[UILabel alloc]initWithFrame:CGRectMake(0,90 , HOLS.size.width / 3 , 30)];
    [self.contentView addSubview:self.weatherLabel];
    
    self.tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,130, HOLS.size.width / 3 , 30)];
    [self.contentView addSubview:self.tempLabel];
    
}
- (void)setDic:(NSMutableDictionary *)dic
{
    _dic = dic;
    NSString *times = [_dic objectForKey:@"sh"];
    NSString *timeText = [times stringByAppendingString:@"时"];
    
    NSString *weather = [_dic objectForKey:@"weather"];
    NSString *weatherNow = @"天气:";
    NSString *weat = [weatherNow stringByAppendingString:weather];
    NSString *temp = [_dic objectForKey:@"temp1"];
    NSString *tomp = @"温度:";
    NSString *te = [temp stringByAppendingString:@"℃"];
    NSString *Temp = [tomp stringByAppendingString:te];
    NSString *cal = [_dic objectForKey:@"date"];
    self.timeLabel.text = timeText;
    self.timeLabel.textAlignment = 1;
    self.weatherLabel.text = weat;
    self.weatherLabel.textAlignment = 1;
    self.tempLabel.text = Temp;
    self.tempLabel.textAlignment = 1;
    self.calLabel.text = cal;
    self.calLabel.textAlignment = 1;
}

@end
